package model;
// default package

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Trole entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "trole", catalog = "test", uniqueConstraints = @UniqueConstraint(columnNames = "rolename"))
public class Trole implements java.io.Serializable {

	// Fields

	private String id;
	private String rolename;
	private String description;
	private Set<Tuser> tusers = new HashSet<Tuser>(0);
	private Set<Trolepermission> trolepermissions = new HashSet<Trolepermission>(0);

	// Constructors

	/** default constructor */
	public Trole() {
	}

	/** minimal constructor */
	public Trole(String id) {
		this.id = id;
	}

	/** full constructor */
	public Trole(String id, String rolename, String description, Set<Tuser> tusers, Set<Trolepermission> trolepermissions) {
		this.id = id;
		this.rolename = rolename;
		this.description = description;
		this.tusers = tusers;
		this.trolepermissions = trolepermissions;
	}

	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "rolename", unique = true)
	public String getRolename() {
		return this.rolename;
	}

	public void setRolename(String rolename) {
		this.rolename = rolename;
	}

	@Column(name = "description")
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "trole")
	public Set<Tuser> getTusers() {
		return this.tusers;
	}

	public void setTusers(Set<Tuser> tusers) {
		this.tusers = tusers;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "trole")
	public Set<Trolepermission> getTrolepermissions() {
		return this.trolepermissions;
	}

	public void setTrolepermissions(Set<Trolepermission> trolepermissions) {
		this.trolepermissions = trolepermissions;
	}

}